# -*- coding: utf-8 -*-

from django.db import models
from django.conf import settings
import os
# Create your models here.

class Danisman(models.Model):
  name = models.CharField(max_length=256)
  image = models.ImageField(upload_to = os.path.join(settings.UPLOAD_ROOT, "gallery", settings.UPLOAD_PATH),
                            help_text = "Danisman resmi upload ediniz.", null=True, blank=True)
  alt_text = models.CharField(max_length=256, null=True, blank=True)
  description = models.TextField(null=True, blank=True)
  weight = models.IntegerField(max_length=10)
  is_active = models.BooleanField(default=False, help_text=u"Seçilirse eklediğiniz yazı site de görünecektir.")

  def __unicode__(self):
      return self.name

class Makale(models.Model):
  danisman = models.ForeignKey(Danisman)
  title = models.TextField()
  description = models.TextField()
  image = models.ImageField(upload_to = os.path.join(settings.UPLOAD_ROOT, "gallery", settings.UPLOAD_PATH),
                            help_text = "Danisman resmi upload ediniz.", null=True, blank=True)
  alt_text = models.CharField(max_length=256)
  weight = models.IntegerField(max_length=10)                            
  is_active = models.BooleanField(default=False, help_text=u"Seçilirse eklediğiniz yazı site de görünecektir.")
  
  def __unicode__(self):
      return self.title
  
